package com.example.base;



import com.example.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class RequestQuery {

    private Integer page = 0;

    private Integer rows = 20;

    private String sort =null;

    private String order = "desc";

    private Map<String, Object> param = new HashMap<>();

    private ResponsePageVO responsePageVO = new ResponsePageVO();

    public Integer getPage() {

        return page;
    }

    public void setPage(Integer page) {

        this.page = page;
    }

    public Integer getRows() {

        return rows;
    }

    public void setRows(Integer rows) {

        this.rows = rows;
    }

    public String getSort() {

        return sort;
    }

    public void setSort(String sort) {

        if (StringUtils.isNotEmpty(sort) && sort.startsWith("str")) {
            sort = sort.replace("str", "");
            sort = StringUtils.toSqlName(sort);
        }
        this.sort = sort;
    }

    public String getOrder() {

        return order;
    }

    public void setOrder(String order) {

        this.order = order;
    }

    public Map<String, Object> getQueryParam() {

        return param;
    }

    public void setQueryParam(Map<String, Object> queryParam) {

        this.param = queryParam;
    }
    public RequestQuery  addQueryParam(String key,Object value)
    {
        this.param.put(key,value);
     return this;
    }

    public ResponsePageVO getResponsePageVO() {

        return responsePageVO;
    }

    public void setResponsePageVO(ResponsePageVO responsePageVO) {

        this.responsePageVO = responsePageVO;
    }

}
